package com.eurobcoin.trading;

import java.util.Date;

import org.apache.ibatis.session.SqlSession;

import com.eurobcoin.dao.mapper.UserOrderAuditMapper;
import com.eurobcoin.dao.model.UserOrderAudit;

public class OrderAuditManager {

	public void auditOrder(
			SqlSession sqlSession,
			String type,
			int amount,
			int price,
			String firstCurrencyCode,
			String secondCurrencyCode,
			String username) {
		
		UserOrderAuditMapper userOrderAuditMapper = sqlSession.getMapper(UserOrderAuditMapper.class);
		UserOrderAudit userOrderAudit = new UserOrderAudit();
		userOrderAudit.setUoa_amount(amount);
		userOrderAudit.setUoa_left_currency(firstCurrencyCode);
		userOrderAudit.setUoa_order_type(type);
		userOrderAudit.setUoa_price(price);
		userOrderAudit.setUoa_right_currency(secondCurrencyCode);
		userOrderAudit.setUoa_timestamp(new Date());
		userOrderAudit.setUoa_user_name(username);
		
		userOrderAuditMapper.insert(userOrderAudit);
		
	}
	
}
